package in.muton.panels.paginator.helpers.deletelinks;

import in.muton.edushare.pages.common.EdusharePanel;
import in.muton.panels.paginator.badgehelpers.course.DeptBadgeInterface;

import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.IModel;

import com.edushare.common.vo.Departments;

public class DeptDelete extends Link<Void> {
	private static final long serialVersionUID = 4302408811657957059L;

	public DeptDelete(String id, IModel<Departments> dept,
			DeptBadgeInterface dbi, EdusharePanel panel) {
		super(id);
		this.dbi = dbi;
		this.deptModel = dept;
		this.panel = panel;
	}

	@Override
	public boolean isVisible() {
		return (dbi != null && dbi.isAdmin());
	}

	@Override
	public void onClick() {
		panel.setError(dbi.removeDept(deptModel));
	}

	private DeptBadgeInterface dbi;
	private IModel<Departments> deptModel;
	private EdusharePanel panel;
}